package com.sanyang.lawyer.service.system;

import com.sanyang.lawyer.entity.HrFlexigrid;
import com.sanyang.lawyer.entity.System_user;
import com.sanyang.lawyer.mapper.system.System_userMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @program: lawyer
 * @description: 用户表事务
 * @author: Mis.Feng
 * @create: 2019-10-11 10:16
 **/

@Service
public class UserService{
    @Autowired
    private System_userMapper userMapper;

    //用户表查询所有
    public List<System_user> select(Map map){
        return userMapper.select(map);
    }
    //用户表根据id查询
    public System_user getById(int id){
        return userMapper.getById(id);
    }
    //添加
    public void insert(String userName,int roleName,int hrName,String password){
        userMapper.insert(userName,roleName,hrName,password);
    }
    //修改密码
    public void updatePwd(int id,String pwd){
       userMapper.updatePwd(id,pwd);
    }
    //修改用户
    public void updateUser(int userid,String userName,int roleName){
        userMapper.updateUser(userid,userName,roleName);
    }
    //删除
    public void delete(int id){
        userMapper.deleteById(id);
    }
    //登录
    public System_user login(String user_name,String user_pwd){
        return userMapper.login(user_name,user_pwd);
    }
    public String getBypwd(int id){
        return userMapper.getBypwd(id);
    }

    public Integer selectCount(Map map) {
        return userMapper.selectCount(map);
    }

    //添加用户时判断员工是否存在
    public int getByEmpId(int empId){
        return userMapper.getByEmpId(empId);
    }
    //添加用户时判断用户名不能重复
    public int getByuserName(String userName){
        return userMapper.getByuserName(userName);
    }
}
